/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gm.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Med EL MOUDDENE
 */
@Entity
@Table(name = "caracteristique")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Caracteristique.findAll", query = "SELECT c FROM Caracteristique c"),
    @NamedQuery(name = "Caracteristique.findByIdCaractiristique", query = "SELECT c FROM Caracteristique c WHERE c.idCaractiristique = :idCaractiristique")})
public class Caracteristique implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_CARACTIRISTIQUE")
    private Integer idCaractiristique;
    @Lob
    @Size(max = 65535)
    @Column(name = "LIBELLE")
    private String libelle;
    @JoinColumn(name = "ID_TYPE", referencedColumnName = "ID_TYPE")
    @ManyToOne(optional = false)
    private TypeAtcd idType;

    public Caracteristique() {
    }

    public Caracteristique(Integer idCaractiristique) {
        this.idCaractiristique = idCaractiristique;
    }

    public Integer getIdCaractiristique() {
        return idCaractiristique;
    }

    public void setIdCaractiristique(Integer idCaractiristique) {
        this.idCaractiristique = idCaractiristique;
    }

    public String getLibelle() {
        return libelle;
    }

    public void setLibelle(String libelle) {
        this.libelle = libelle;
    }

    public TypeAtcd getIdType() {
        return idType;
    }

    public void setIdType(TypeAtcd idType) {
        this.idType = idType;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCaractiristique != null ? idCaractiristique.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Caracteristique)) {
            return false;
        }
        Caracteristique other = (Caracteristique) object;
        if ((this.idCaractiristique == null && other.idCaractiristique != null) || (this.idCaractiristique != null && !this.idCaractiristique.equals(other.idCaractiristique))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.gm.entities.Caracteristique[ idCaractiristique=" + idCaractiristique + " ]";
    }
    
}
